package controller

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"vueAdmin/application/logic"
	"vueAdmin/application/utils"
	"vueAdmin/application/validation"
)

// 登录
func Login(c *gin.Context) {
	defer utils.ErrHandle(c)
	if next := validation.CheckLogin(c); !next {
		return
	}
	username := c.PostForm("username")
	password := c.PostForm("password")
	res := logic.GetToken(username, password)
	c.JSON(http.StatusOK, utils.SetPackageData(1101, nil))
	c.Abort()
	return ""
	c.JSON(http.StatusOK, utils.SetPackageData(0, utils.BackLoginData{Token: res}))
}
